import * as React from 'react'
import { BrowserRouter, Route, Switch} from 'react-router-dom'
import Home from './pages/Home'
import Put from './pages/Put'
import Open from './pages/Open'
import NotFound from './pages/NotFound'
import PutDone from './pages/PutDone'

function App(){
    return (
      <BrowserRouter>
        <div className="container">
          {/* 根据URL路径匹配路由组件，渲染到该位置 */}
          <Switch>
            <Route exact path="/"  component={Home} />
            <Route path="/put" component={Put} />
            <Route path="/open" component={Open}/>
            <Route path="/put_done" component={PutDone} />
            {/* 这是一个默认页面，如果前面的路由都没有被匹配到，就会渲染这个组件，相当于404，一定要放到最后 */}
            <Route component={NotFound} />
          </Switch>
        </div>
      </BrowserRouter>
    )
}
export default App
